package com.ruoyi.web.controller.solidYunshu;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.solidYunshu.domain.GfYunshu;
import com.ruoyi.solidYunshu.service.IGfYunshuService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 固废运输企业Controller
 * 
 * @author ruoyi
 * @date 2021-09-16
 */
@RestController
@RequestMapping("/solidYunshu/yunshu")
public class GfYunshuController extends BaseController
{
    @Autowired
    private IGfYunshuService gfYunshuService;

    /**
     * 查询固废运输企业列表
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:list')")
    @GetMapping("/list")
    public TableDataInfo list(GfYunshu gfYunshu)
    {
        startPage();
        List<GfYunshu> list = gfYunshuService.selectGfYunshuList(gfYunshu);
        return getDataTable(list);
    }

    /**
     * 导出固废运输企业列表
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:export')")
    @Log(title = "固废运输企业", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GfYunshu gfYunshu)
    {
        List<GfYunshu> list = gfYunshuService.selectGfYunshuList(gfYunshu);
        ExcelUtil<GfYunshu> util = new ExcelUtil<GfYunshu>(GfYunshu.class);
        return util.exportExcel(list, "固废运输企业数据");
    }

    /**
     * 获取固废运输企业详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:query')")
    @GetMapping(value = "/{gyId}")
    public AjaxResult getInfo(@PathVariable("gyId") Long gyId)
    {
        return AjaxResult.success(gfYunshuService.selectGfYunshuById(gyId));
    }

    /**
     * 新增固废运输企业
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:add')")
    @Log(title = "固废运输企业", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GfYunshu gfYunshu)
    {
        return toAjax(gfYunshuService.insertGfYunshu(gfYunshu));
    }

    /**
     * 修改固废运输企业
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:edit')")
    @Log(title = "固废运输企业", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GfYunshu gfYunshu)
    {
        return toAjax(gfYunshuService.updateGfYunshu(gfYunshu));
    }

    /**
     * 删除固废运输企业
     */
    @PreAuthorize("@ss.hasPermi('solidYunshu:yunshu:remove')")
    @Log(title = "固废运输企业", businessType = BusinessType.DELETE)
	@DeleteMapping("/{gyIds}")
    public AjaxResult remove(@PathVariable Long[] gyIds)
    {
        return toAjax(gfYunshuService.deleteGfYunshuByIds(gyIds));
    }
}
